package com.yxzc.chapter07.packagedemo.myExtends

/**
 *
 * @author wu
 * @create 2021-09-14-11:30 
 */
object AbstractDemo01 {
  def main(args: Array[String]): Unit = {
    val animal = new Animal {
      override var name: String = _
      override var age: Int = _
      override def cry(): Unit = {
      println(1)

      }
    }
    println( animal.color)
  }

}
abstract class Animal{
  var name : String //抽象的字段
  var age : Int // 抽象的字段
  var color : String = "black" //普通属性
  def cry() //抽象方法,不需要标记 abstract
}
